package com.example.jetpackstu.logic.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.example.jetpackstu.logic.entity.News

@Dao
interface NewsDao {
    @Query("SELECT * FROM news")
    fun getAll(): LiveData<List<News>>

    @Query("SELECT * FROM news WHERE id = :id")
    fun getById(id: Long): LiveData<News>

    @Insert
    fun insert(vararg news: News)

    @Update
    fun update(vararg news: News)

    @Delete
    fun delete(news: News)

    @Query("delete from news where id =:id")
    fun deleteById(id: Long)
}